import EventsUtils from "./EventsUtils";
import AlertBox from "../components/alert/AlertBox";
import Index from "../components/alert";

/**
 * 提示框工具
 */
export default class AlertUtils {
    static alert(options){
        EventsUtils.emit(AlertBox.events.ALERT, options);
    }
}

for (let name in Index.types) {
    AlertUtils[name.toLowerCase()] = function (content, survivalTime, otherOptions) {
        AlertUtils.alert(Object.assign({
            content: content,
            type: Index.types[name],
            survivalTime: survivalTime,
            closable: true
        }, otherOptions));
    }
}
